import axios from '~/plugins/axios';


/**
 * 商品列表
 *
 * @param commit
 * @param state
 * @param preload
 */
export const productsList = function({commit, state}, preload) {
    return axios.get(process.env.baseUrl + '/b2c/goods/list', {
        params: preload || {}
    })
};



/**
 * 商品详情
 *
 * @param commit
 * @param state
 * @param preload
 */
export const productDetail = function({commit, state}, preload) {
    return axios.get(process.env.baseUrl + '/b2c/goods/detail/get', {
        params: preload || {}
    })
};


/**
 * 下架商品
 *
 * @param commit
 * @param state
 * @param preload
 */
export const unPublishedProduct = function({commit, state}, preload) {
    return axios.post(process.env.baseUrl + '/b2c/goods/unpublished', preload || {});
};



/**
 * 删除商品
 *
 * @param commit
 * @param state
 * @param preload
 */
export const deleteProduct = function({commit, state}, preload) {
    return axios.post(process.env.baseUrl + '/b2c/goods/delete', preload || {});
};



/**
 * 商品类目
 *
 * @param commit
 * @param state
 * @param preload
 */
export const categoryList = function({commit, state}, preload) {
    return axios.get(process.env.baseUrl + '/b2c/goods/seller/theme/list', {
        params: preload || {}
    })
};

/**
 * 添加商品类目
 *
 * @param commit
 * @param state
 * @param preload
 */
export const addCategory = function({commit, state}, preload) {
    return axios.get(process.env.baseUrl + '/b2c/goods/seller/theme/insert', {
        params: preload || {}
    })
};

/**
 * 删除商品类目
 *
 * @param commit
 * @param state
 * @param preload
 */
export const deleteCategory = function({commit, state}, preload) {
    return axios.get(process.env.baseUrl + '/b2c/goods/seller/theme/delete', {
        params: preload || {}
    })
};